package com.winning.pmph.ctrl;

import com.winning.pmph.entity.DataPermission;
import com.winning.pmph.service.DataPermissionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(value = "系统管理/角色管理")
@RestController
@RequestMapping("/pmph/action/dataPermission")
public class DataPermissionCtrl {

    @Resource
    private DataPermissionService dataPermissionService;

    @ApiOperation(value = "selectDataPermission", notes = "查询用户或角色的数据权限")
    @GetMapping("selectDataPermission")
    public DataPermission selectDataPermission(String userName, String roleId) {
        return dataPermissionService.selectDataPermission(userName, roleId);
    }

    @ApiOperation(value = "saveDataPermission", notes = "保存用户或角色的数据权限")
    @PostMapping("saveDataPermission")
    public void saveDataPermission(@RequestBody DataPermission dataPermission) {
        dataPermissionService.saveDataPermission(dataPermission);
    }
}
